package com.zhouyu.aop.advice;

import org.springframework.aop.ThrowsAdvice;

import java.lang.reflect.Method;

/**
 * @author 周瑜
 */
public class ZhouyuThrowsAdvice implements ThrowsAdvice {

	/**
	 * @param method
	 * @param args
	 * @param target
	 * @param ex      这里只抓取空指针异常。可以定义为哪个异常
	 */
	public void afterThrowing(Method method, Object[] args, Object target, NullPointerException ex) {
		System.out.println("方法抛出异常后执行");
	}

}
